void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(PA1, PWM);
  pinMode(PA0, PWM);
  pwmWrite(PA1, 0);
  pwmWrite(PA0, 0);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (Serial.available() > 0) {
    int responsedata = Serial.read();
    if (responsedata != -1) {

      if (responsedata == 0x01) {
        pwmWrite(PA1, 0);
        pwmWrite(PA0, 0);
        // 1 停止
      }

      if (responsedata == 0x02) {
        pwmWrite(PA0, 21845);
        pwmWrite(PA1, 0);
        // 2 正慢速
      }

      if (responsedata == 0x03) {
        pwmWrite(PA0, 43690);
        pwmWrite(PA1, 0);
        // 3 正中速
      }

      if (responsedata == 0x04) {
        pwmWrite(PA0, 65535);
        pwmWrite(PA1, 0);
        // 4 正高速
      }


      if (responsedata == 0x05) {
        pwmWrite(PA1, 21845);
        pwmWrite(PA0, 0);
        //5 反慢速
      }

      if (responsedata == 0x06) {
        pwmWrite(PA1, 43690);
        pwmWrite(PA0, 0);
        //6 反中速
      }
      
      if (responsedata == 0x07) {
        pwmWrite(PA1, 65535);
        pwmWrite(PA0, 0);
        //6 反中速
      }
    }
  }
}
